.line{
    position: absolute;
    top: 22%;
    left: 22%;
    width: 80%;
    height: 2px;
    background-color: gray;
    transform-origin: left top;
    transform: rotate(45deg) scaleX(0);
    z-index: 1;
}
.growing-animating {
    animation: growLine 0.3s forwards;
  }
  
  .shrinking-animating {
    animation: shrinkLine 0.3s forwards;
  }
  
  @keyframes growLine {
    from {
      transform: rotate(45deg) scaleX(0);
    }
    to {
      transform: rotate(45deg) scaleX(1);
    }
  }
  
  @keyframes shrinkLine {
    from {
      transform: rotate(45deg) scaleX(1);
    }
    to {
      transform: rotate(45deg) scaleX(0);
    }
  }